#pragma once

#include <vex/core/contract/handle.h>
#include <vex/core/implementation/ownership_policies.h>

#include "CppUnitTest.h"

namespace tests {

    namespace vc = vex::core;
    namespace mst = Microsoft::VisualStudio::CppUnitTestFramework;

    struct handle_properties {
        static void verify_sharing(vc::contract::handle const * p_handle, vc::shared_synchronized_tag)
        {
            mst::Assert::IsTrue(p_handle->has_synchronized_ref_count());
            mst::Assert::IsTrue(p_handle->is_shareable());
        }

        static void verify_sharing(vc::contract::handle const * p_handle, vc::shared_tag)
        {
            mst::Assert::IsFalse(p_handle->has_synchronized_ref_count());
            mst::Assert::IsTrue(p_handle->is_shareable());
        }

        static void verify_sharing(vc::contract::handle const * p_handle, vc::unique_tag)
        {
            mst::Assert::IsFalse(p_handle->has_synchronized_ref_count());
            mst::Assert::IsFalse(p_handle->is_shareable());
        }

        static void verify_sharing(vc::contract::handle const * p_handle, vc::unmanaged_tag)
        {
            mst::Assert::IsFalse(p_handle->has_synchronized_ref_count());
            mst::Assert::IsFalse(p_handle->is_shareable());
        }
    };
}